<?php
namespace app\serverrecommend\service\recommend;

use \app\manage\service\ApiBase;

/**
 * @author:      李颖
 * @DateTime:    2017-09-28 17:29:08
 * @Description: 推荐位分类
 */
class Recommend extends ApiBase
{
    protected $recommendLogic = '\app\serverrecommend\logic\Recommend';
    protected $recommendValidate = '\app\serverrecommend\validate\Recommend';

    use \app\serveruser\traits\AddAppIdToRunOne;

    
    //添加推荐位分类
    public function addRecommend(): array 
    {
        $data = $this->haveIssetReceiveData(['app_id'=>0,'other_app_read'=>'','is_public'=>0,'pid'=>0,'name'=>' ','action'=>' ','profile_pic'=>'','desc'=>'','order'=>100, 'token'=>' ']);
        return $this->oneStepRun($data, 'serverrecommend/recommend/Recommend/addRecommend', '', '1', $this->recommendValidate, $this->recommendLogic);
    }

    //编辑推荐位分类
    public function editRecommend(): array 
    {
        $data = $this->issetReceiveData(['id'=>0,'other_app_read'=>'','is_public'=>0,'pid'=>0,'name'=>' ','action'=>' ','profile_pic'=>'','desc'=>'','order'=>100, 'token'=>' ']);
        return $this->_addAppIdToRunOne($data, 'serverrecommend/recommend/Recommend/editRecommend', $this->recommendValidate, $this->recommendLogic, false, 'edit');
    }

    // 获取本应用下的推荐位分类树
    public function getTree(): array 
    {
        $data = $this->haveIssetReceiveData(['id'=>0, 'token'=>' ']);
        return $this->_addAppIdToRunOne($data, 'serverrecommend/recommend/Recommend/getTree', $this->recommendValidate, $this->recommendLogic, false, 'getTree');
    }

    /*获取某个不删除的分类详情*/
    public function oneCateInfo(): array 
    {
        $data = $this->receiveData(['id'=>0, 'token'=>' ']);
        return $this->_addAppIdToRunOne($data, 'serverrecommend/recommend/Recommend/oneCateInfo', $this->recommendValidate, $this->recommendLogic, false, '');
    }

    /*后台删除某个推荐分类*/
    public function delOneCate(): array 
    {
        $data = $this->receiveData(['id'=>0, 'token'=>' ']);
        return $this->_addAppIdToRunOne($data, 'serverrecommend/recommend/Recommend/delOneCate', $this->recommendValidate, $this->recommendLogic, false, '');
    }
    
}
